﻿<%@ Page Language="C#" Inherits="PageBase" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>日志管理</title>
    <link href="../js/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../js/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../css/default.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="../js/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../js/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../js/common.js" type="text/javascript"></script>
    <script type="text/javascript">
        var me = {
            datagrid1: null,
            edit_form: null,
            edit_window: null,
            search_form: null,
            search_window: null,
            view_window: null,
            datagrid2: null,
            idFiled: 'LogID',
            actionUrl: '../ashx/SysLog.ashx'
        };

        $(function () {
            pageInit();
            loadGrid();
        });

        function pageInit() {
            me.edit_window = $('#edit_window');
            me.edit_form = me.edit_window.find('#edit_form');
            me.search_window = $('#search_window');
            me.search_form = me.search_window.find('#search_form');
            me.view_window = me.search_window.find('#view_window');
            me.datagrid2 = $('#datagrid2');
            me.datagrid1 = $('#datagrid1');

            $('#btn_edit_ok,#btn_edit_cancel,#btn_search_ok,#btn_search_cancel').linkbutton();
            $('#btn_edit_ok').click(function () {   SaveData(); });
            $('#btn_search_ok').click(function () {   me.datagrid1.datagrid({ pageNumber: 1 });  });
            $('#btn_edit_cancel').click(function () {  me.edit_window.window('close');   });
            $('#btn_search_cancel').click(function () {   me.search_window.window('close'); });
        }

        //加载列表
        function loadGrid() {
            me.datagrid1.datagrid({
                singleSelect: false,
                sortName: me.idFiled,
                idField: me.idFiled,
                url: me.actionUrl + '?Method=List',
                frozenColumns: [[
	                { field: 'ck', checkbox: true }
				]],
                columns: [[
                  { field: 'IP', title: '客户端IP', width: 100, sortable: true, align: 'left' },
                  { field: 'Page', title: '操作路径', width: 350, sortable: true, align: 'left' },
                  { field: 'LoginName', title: '操作人', width: 80, sortable: true, align: 'center' },
                  { field: 'AddTime', title: '操作时间', width: 140, sortable: true, align: 'center' },
                  { field: 'Message', title: '内容', width: 400, sortable: true, align: 'left' }
                ]],
                toolbar: ['-'
                /*<%if(CheckFun("Delete")){ %>{*/
                , { text: '删除', iconCls: 'icon-remove', handler: function () { var ids = []; var rows = me.datagrid1.datagrid('getSelections'); if (rows.length == 0) { showError('请选择一条记录进行操作!'); } else { for (var i = 0; i < rows.length; i++) { ids.push(rows[i][me.idFiled]); } Delete(ids.join(',')); } } }, '-'
                /*<%} %>*/
                /*<%if(CheckFun("Select")){ %>*/
                 , { text: '查找', iconCls: 'icon-search', handler: function () { me.search_window.window('open'); } }, '-'
                /*<%} %>*/
                   ],
                onBeforeLoad: function (param) {
                    me.search_form.find('input').each(function (index) { param[this.name] = $(this).val(); });
                }
            });

        }

        function Delete(ids) {
            $.messager.confirm('提示信息', '确认要删除选择项？【' + ids + '】', function (isClickedOk) {
                if (isClickedOk) {
                    $.ajax({
                        url: me.actionUrl,
                        data: { Method: 'Delete', ids: ids },
                        success: function (returnData) {
                            if (returnData) {
                                if (returnData.isOk == 1) {
                                    showInfo(returnData.message);
                                    me.datagrid1.datagrid('reload');
                                } else {
                                    showError(returnData.message);
                                }
                            }
                        }
                    });
                }
            })
        }  

    </script>
</head>
<body class="easyui-layout">
    <noscript>
        <div style="position: absolute; z-index: 100000; height: 2046px; top: 0px; left: 0px;
            width: 100%; text-align: center;">
            <img src="../images/noscript.gif" alt='抱歉，请开启脚本支持！' />
        </div>
    </noscript>
    <div title="数据列表" region="center" border="false">
        <table id="datagrid1">
        </table>
    </div>
    <div id="search_window" class="easyui-window" closed="true" title="查询窗口" style="width: 350px;
        height: 200px; padding: 5px;" closed="true">
        <div class="easyui-layout" fit="true">
            <div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
                <form id="search_form" method="post">
                <table>
                    <tr>
                        <td>
                            关键字：
                        </td>
                        <td>
                            <input name="Message" id="Message" style="width: 150px;" />
                        </td>
                    </tr>
                </table>
                </form>
            </div>
            <div region="south" border="false" style="text-align: center; height: 30px; line-height: 30px;">
                <a href="javascript:void(0)" id="btn_search_ok" icon="icon-ok">确定</a> <a href="javascript:void(0)"
                    id="btn_search_cancel" icon="icon-cancel">关闭</a>
            </div>
        </div>
    </div>
</body>
</html>
